package com.silence.springboot.base;

import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.core.keygen.KeyGenerators;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author silence
 * @email 792245022@qq.com
 * @create 2023-09-19 21:35
 */
@Data
@Accessors(chain = true)
@Schema(name = "BaseEntity", description = "基础实体类")
public class BaseEntity implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * ID
     */
    @Schema(description = "ID")
    @Id(keyType = KeyType.Generator, value= KeyGenerators.snowFlakeId)
    private Long id;

    /**
     * 创建时间
     */
    @Column(value = "create_time")
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    @Column(value = "update_time")
    private LocalDateTime updateTime;

    /**
     * 创建人
     */
    @Column(value = "create_user")
    private String createUser;

    /**
     * 更新人
     */
    @Column(value = "update_user")
    private String updateUser;

    /**
     * 删除标记（0：可用 1：不可用）
     */
    @Column(isLogicDelete = true, value = "del_flag")
    private Integer delFlag;

}
